package org.example.mcp.config;

import org.example.mcp.server.ToolServer;
import org.springframework.ai.tool.ToolCallbackProvider;
import org.springframework.ai.tool.method.MethodToolCallbackProvider;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
 * @author zhengxujie
 * 2025/05/07/上午9:31
 */
@Configuration
public class McpServerConfig implements WebMvcConfigurer {
    @Bean
    public ToolCallbackProvider openLibraryTools(ToolServer toolServer) {
        return MethodToolCallbackProvider.builder().toolObjects(toolServer).build();
    }

    @Override
    public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
        configurer.setDefaultTimeout(0);
    }

}